﻿using System.Text;

namespace Koala.Pro.CodeGenerator.UI.Common.Adapter
{
    public sealed class AdapterUtil
    {
        public static string GetOutputPath(string outputDir, string rootNameSpace)
        {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append(CheckEndBySlash(outputDir));
            stringBuilder.Append(CheckEndBySlash(rootNameSpace));
            return stringBuilder.ToString();
        }

        public static string CheckEndBySlash(string pathName)
        {
            if (!pathName.EndsWith("\\"))
            {
                return pathName + "\\";
            }
            return pathName;
        }

        public static string GetSimplyNetType(string netType)
        {
            string text = netType;
            switch (netType.ToLower())
            {
                case "system.string":
                    return "string";
                case "system.int32":
                    return "int";
                case "system.boolean":
                    return "bool";
                case "system.decimal":
                    return "decimal";
                case "system.double":
                    return "double";
                case "system.float":
                    return "float";
                case "system.byte[]":
                    return "byte[]";
                case "system.datetime":
                    return "DateTime";
                default:
                    return netType.ToLower().Replace("system.", string.Empty);
            }
        }
    }
}
